package org.thoneloe.config;

import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.thoneloe.banner.ThoneloeBanner;
import org.thoneloe.constant.BannerConstant;
import org.thoneloe.properties.BannerProperties;

/**
 * @Author: LYX
 * @CreateTime: 2025-05-17
 */
@AutoConfiguration //表明当前类是一个自动配置类
@Configuration
@EnableConfigurationProperties(BannerProperties.class)
public class BannerConfig {

    @Bean
    @ConditionalOnProperty(name = BannerConstant.ENABLED_PRINT_BANNER, matchIfMissing = true, havingValue = "true")
    public ThoneloeBanner thoneloeBanner(BannerProperties bannerProperties){
        return new ThoneloeBanner(bannerProperties);
    }
}
